#include <accent/algorithms/count.hpp>
#include "test_base.hpp"

class Count : public ::testing::TestWithParam<ivec> {};

TEST_P(Count, countIsInputSize) {
  ivec v = GetParam();
  ASSERT_EQ(v.size(), count(all(v)));
}

INSTANTIATE_TEST_CASE_P(variousVectors, Count,
  ::testing::Values(ivec{}, ivec{1}, ivec{1, 2}, ivec{1, 2, 3}));

TEST(CountP, countsCorrectly) {
  ivec v = { 1, -2, 3, -4, 5 };
  ASSERT_EQ(3L, count(all(v), positive()));
}

class CountBidirectional : public ::testing::TestWithParam<ivec> {};

TEST_P(CountBidirectional, countIsInputSize) {
  ivec v = GetParam();
  ASSERT_EQ(v.size(), count(all_b(v)));
}

INSTANTIATE_TEST_CASE_P(variousVectors, CountBidirectional,
  ::testing::Values(ivec{}, ivec{1}, ivec{1, 2}, ivec{1, 2, 3}));
